<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUploadFileTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('upload_file', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('storage', 128)->default('local')->nullable()->comment('存储方式');
            $table->string('file_url', 128)->nullable()->comment('存储域名');
            $table->string('file_name', 128)->unique()->nullable()->comment('文件名称');
            $table->integer('file_size')->unsigned()->default(0)->comment('文件大小(字节)');
            $table->string('file_type', 128)->nullable()->comment('文件类型');
            $table->string('extension', 128)->nullable()->comment('文件扩展名');
            $table->timestamps();
        });

        \DB::statement("ALTER TABLE `upload_file` comment '文件库记录表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('upload_file');
    }
}
